#ifndef SYSCALL_H
#define SYSCALL_H

#include "comm/types.h"

#define SYSCALL_PARAM_COUNT 5
#define SYS_SLEEP_ID        0
#define SYS_GET_PRESENT_ID  1
#define SYS_FORK_ID         2
#define SYS_EXECVE_ID       3
#define SYS_YIELD_ID        4
#define SYS_EXIT_ID         5
#define SYS_WAIT_ID         6

#define SYS_OPEN_ID         50
#define SYS_READ_ID         51
#define SYS_WRITE_ID        52
#define SYS_CLOSE_ID        53
#define SYS_LSEEK_ID        54

#define SYS_ISATTY_ID       55
#define SYS_SBRK_ID         56
#define SYS_FSTAT_ID        57
#define SYS_DUP_ID          58
#define SYS_IOCTL_ID        59


#define SYS_OPENDIR_ID      60
#define SYS_READDIR_ID      61
#define SYS_CLOSEDIR_ID     62

#define SYS_UNLINK_ID       63

#define SYS_PRINT_MSG_ID    100

typedef struct _syscall_frame_t
{
    uint32_t eflags;
    uint32_t gs,fs,es,ds;
    uint32_t edi,esi,ebp,dumpy,ebx,edx,ecx,eax; // dump是esp
    uint32_t eip,cs;
    uint32_t func_id,arg0,arg1,arg2,arg3;
    uint32_t esp,ss;
}syscall_frame_t;

void exception_handler_syscall();
void do_handler_syscall(syscall_frame_t * syscall_frame);
#endif // !SYSCALL_H